package com.itheima.tliasmanagementspringboot.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private Integer code;
    private String msg;
    private Object data;

    //成功(增删改)
    public static R ok(){

        return new R(1, "OK", null);
    }

    //成功(查询)
    public static R ok(Object data){

        return new R(1, "OK", data);
    }

    //失败()
    public static R error(String msg){
        return new R(0, msg, null);
    }
}
